package com.ryan.demo.url.utils;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import org.junit.Test;

public class DecoderDemo {
	public static String decode(String sourceString,String coding) throws UnsupportedEncodingException{
		return URLDecoder.decode(sourceString,coding);
	}
	
	@Test
	public void decodeTest(){
		try {
			System.out.println(DecoderDemo.decode("%E4%BD%A0%E5%A5%BD", "utf-8"));
			System.out.println(DecoderDemo.decode("%FE%FF%4F%60%59%7D", "utf-16"));
			System.out.println(DecoderDemo.decode("%C4%E3%BA%C3", "GBK"));
			System.out.println(DecoderDemo.decode("%C4%E3%BA%C3", "GB2312"));
			System.out.println(DecoderDemo.decode("%C4%E3%BA%C3", "GB18030"));
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
	}
}
